<?php

/**
 * CompanyInformation form base class.
 *
 * @method CompanyInformation getObject() Returns the current form's model object
 *
 * @package    ecrm
 * @subpackage form
 * @author     Saul Santiago
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseCompanyInformationForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                => new sfWidgetFormInputHidden(),
      'name'              => new sfWidgetFormInputText(),
      'address1'          => new sfWidgetFormTextarea(),
      'street'            => new sfWidgetFormTextarea(),
      'barangay'          => new sfWidgetFormTextarea(),
      'city_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('City'), 'add_empty' => true)),
      'zip_code'          => new sfWidgetFormInputText(),
      'fax_no'            => new sfWidgetFormInputText(),
      'tin'               => new sfWidgetFormInputText(),
      'employment_status' => new sfWidgetFormInputText(),
      'status'            => new sfWidgetFormInputCheckbox(),
      'is_primary'        => new sfWidgetFormInputCheckbox(),
      'designation'       => new sfWidgetFormInputText(),
      'company_name'      => new sfWidgetFormInputText(),
      'company_phone_no'  => new sfWidgetFormInputText(),
      'created_at'        => new sfWidgetFormDateTime(),
      'updated_at'        => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'name'              => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'address1'          => new sfValidatorString(array('max_length' => 256, 'required' => false)),
      'street'            => new sfValidatorString(array('max_length' => 256, 'required' => false)),
      'barangay'          => new sfValidatorString(array('max_length' => 256, 'required' => false)),
      'city_id'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('City'), 'required' => false)),
      'zip_code'          => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'fax_no'            => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'tin'               => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'employment_status' => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'status'            => new sfValidatorBoolean(array('required' => false)),
      'is_primary'        => new sfValidatorBoolean(array('required' => false)),
      'designation'       => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'company_name'      => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'company_phone_no'  => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'created_at'        => new sfValidatorDateTime(),
      'updated_at'        => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('company_information[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'CompanyInformation';
  }

}
